package com.qingzhuge.file.entity;


import com.qingzhuge.entity.BaseBean;
import com.qingzhuge.file.FileStorageEnum;
import com.qingzhuge.file.validator.group.AliyunGroup;
import com.qingzhuge.file.validator.group.QcloudGroup;
import com.qingzhuge.file.validator.group.QiniuGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import java.io.File;

/**
 * @author : zero.xiao
 * @description : 云存储配置信息
 * @date :2018/6/8 0008 下午 15:13
 * @since : 1.0.0
 * @modified :
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class FileStorageConfig extends BaseBean<Long> {
    private static final long serialVersionUID = 1L;
    @Transient
    private Long id;
    /**
     * 云存储配置KEY
     */
    public final static String CLOUD_STORAGE_CONFIG_KEY = "CLOUD_STORAGE_CONFIG_KEY";

    /**类型 0:本地  1：七牛  2：阿里云  3：腾讯云*/
    @NotBlank(message="类型错误", groups = QiniuGroup.class)
    private FileStorageEnum type;

    /**本地存储路径前缀*/
    private String localPrefix = "."+ File.separator +"upload";

    /**七牛绑定的域名*/
    private String qiniuDomain;
    /**七牛路径前缀*/
    private String qiniuPrefix;
    /**七牛ACCESS_KEY*/
    @NotBlank(message="七牛AccessKey不能为空", groups = QiniuGroup.class)
    private String qiniuAccessKey;
    /**七牛SECRET_KEY*/
    @NotBlank(message="七牛SecretKey不能为空", groups = QiniuGroup.class)
    private String qiniuSecretKey;
    /**七牛存储空间名*/
    @NotBlank(message="七牛空间名不能为空", groups = QiniuGroup.class)
    private String qiniuBucketName;

    /**阿里云绑定的域名*/
    private String aliyunDomain;
    /**阿里云路径前缀*/
    private String aliyunPrefix;
    /**阿里云EndPoint*/
    @NotBlank(message="阿里云EndPoint不能为空", groups = AliyunGroup.class)
    private String aliyunEndPoint;
    /**阿里云AccessKeyId*/
    @NotBlank(message="阿里云AccessKeyId不能为空", groups = AliyunGroup.class)
    private String aliyunAccessKeyId;
    /**阿里云AccessKeySecret*/
    @NotBlank(message="阿里云AccessKeySecret不能为空", groups = AliyunGroup.class)
    private String aliyunAccessKeySecret;
    /**阿里云BucketName*/
    @NotBlank(message="阿里云BucketName不能为空", groups = AliyunGroup.class)
    private String aliyunBucketName;

    /**腾讯云绑定的域名*/
    private String qcloudDomain;
    /**腾讯云路径前缀*/
    private String qcloudPrefix;
    /**腾讯云AppId*/
    @NotBlank(message="腾讯云AppId不能为空", groups = QcloudGroup.class)
    private Integer qcloudAppId;
    /**腾讯云SecretId*/
    @NotBlank(message="腾讯云SecretId不能为空", groups = QcloudGroup.class)
    private String qcloudSecretId;
    /**腾讯云SecretKey*/
    @NotBlank(message="腾讯云SecretKey不能为空", groups = QcloudGroup.class)
    private String qcloudSecretKey;
    /**腾讯云BucketName*/
    @NotBlank(message="腾讯云BucketName不能为空", groups = QcloudGroup.class)
    private String qcloudBucketName;
    /**腾讯云COS所属地区*/
    @NotBlank(message="所属地区不能为空", groups = QcloudGroup.class)
    private String qcloudRegion;
}
